import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_demo_2025_1/entity/my_location.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ShareInfo extends StatelessWidget {
  final MyLocation location;
  ShareInfo({ required this.location });
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xFF003a8c),
        foregroundColor: Colors.white,
        title: Text('查看详情')
      ),
      body: SafeArea(
        child: ListView(
          children: [
            Card(
              color: Theme.of(context).cardColor,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: [
                  Padding(
                    padding: EdgeInsets.only(top: 12.w, right: 12.w, bottom: 0, left: 12.w),
                    child: Text('标题：'),
                  ),
                  Padding(
                    padding: EdgeInsets.all(12.w),
                    child: Text(location.title),
                  ),
                  Padding(
                    padding: EdgeInsets.only(top: 12.w, right: 12.w, bottom: 0, left: 12.w),
                    child: Text('描述：'),
                  ),
                  Padding(
                    padding: EdgeInsets.all(12.w),
                    child: Text(location.desc ?? ''),
                  )
                ],
              ),
            ),
            Card(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: [
                  Padding(
                    padding: EdgeInsets.only(top: 12.w, right: 12.w, bottom: 0, left: 12.w),
                    child: Text('图片：'),
                  ),
                  Padding(
                    padding: EdgeInsets.all(12.w),
                    child: (location.image != null && location.image != '') ? Image.file(
                      File(location.image!),
                      width: 300.w,
                      height: 300.w,
                      fit: BoxFit.cover,
                    ) : Container(width: 300.w,height: 300.w, color: Color(0xFFe6f7ff)),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }

}